package com.hdhere.application.controller.admin;

import com.hdhere.application.service.BasicDataService;
import com.hdhere.domain.common.rest.CallResult;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/*******************************************************************************************
 * 类描述：  
 *
 * @author: dustin
 * @date: 2019-03-09 11:11
 * @Description:
 * @version 1.0
 *
 *
 * Version    Date       ModifiedBy                 Content  
 * -------- ---------    ----------         ------------------------  
 * 1.0      2019/3/9       dustin                               
 *******************************************************************************************
 */
@RestController
public class BasicDataController {

    @Autowired
    private BasicDataService basicDataService;

    @ApiOperation(value = "获取枚举列表", notes = "获取枚举列表")
    @GetMapping(value = {"/enum/{content}/getList"})
    public CallResult getEnumList(
            @PathVariable("content") String content,
            @RequestParam(name = "ids", required = false) @ApiParam(value = "包含或者排除的id") String[] ids,
            @RequestParam(name = "include", required = false, defaultValue = "true") @ApiParam(value = "包含或者排除") Boolean include)
            throws Exception {

        List<Map<String, Object>> list = basicDataService.getEnumList(content, ids, include);
        return new CallResult(list);
//        String jsonStr = JSON.toJSONString(result);
//        JSONObject jsonObject = JSON.parseObject(jsonStr);
//
//        return jsonObject;
    }
}
